<!DOCTYPE html>
<html>
<head>
<title>centos7安装jdk</title>
<meta charset='utf-8'>
<link href='https://dn-maxiang.qbox.me/res-min/themes/marxico.css' rel='stylesheet'>
<style></style>
</head>
<body>
<div id='preview-contents' class='note-content'>

<h4>centos7安装jdk</h4>

<hr>

<pre class="prettyprint hljs-dark">
	<code class="hljs bash">
		<span class="hljs-keyword">1.查看已经安装的jdk</span>
		rpm -qa|grep jdk
		
		<span class="hljs-keyword">2.卸载命令</span>
		yum -y remove java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64（示例）
		
		<span class="hljs-keyword">3.下载后解压命令</span>
		tar -zxvf jdk-8u101-linux-x64.tar.gz 
		
		<span class="hljs-keyword">4.设置环境变量</span>
		vim  /etc/profile
		 
		<span class="hljs-keyword">5.etc/profile文件末尾添加如下</span>
		export JAVA_HOME=/usr/local/java/jdk1.8.0_101
		export JRE_HOME=${JAVA_HOME}/jre
		export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
		export PATH=${JAVA_HOME}/bin:$PATH
		
		<span class="hljs-keyword">6.使刚才配置的环境变量生效</span>
		source /etc/profile 
		或者重启
		reboot
	
		<span class="hljs-string">eq</span>
	</code>
</pre>

</div>
</body>
</html>